package cn.acewill.yxd.yunxundian.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.ArrayList;

import cn.acewill.yxd.yunxundian.BaseActivity;
import cn.acewill.yxd.yunxundian.R;
import cn.acewill.yxd.yunxundian.model.EvaluteBean;
import cn.acewill.yxd.yunxundian.model.Schedule;

/**
 * Created by AAA on 2017/4/7.
 */

public class SignEvaAdapter extends BaseAdapter{

    private Context context;
    private ArrayList<EvaluteBean> list;
    public SignEvaAdapter(Context context,ArrayList<EvaluteBean> list){
        this.context=context;
        this.list=list;
    }
    @Override
    public int getCount() {
        return list==null?0:list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if(convertView==null){
            convertView= LayoutInflater.from(context).inflate(R.layout.sign_evalution,parent,false);
            holder=new ViewHolder();
            holder.t1= (TextView) convertView.findViewById(R.id.t1);
            holder.t2= (TextView) convertView.findViewById(R.id.t2);
            holder.t3= (TextView) convertView.findViewById(R.id.t3);
            holder.t4= (TextView) convertView.findViewById(R.id.t4);
            holder.t5= (TextView) convertView.findViewById(R.id.t5);
            holder.t6= (TextView) convertView.findViewById(R.id.t6);
            holder.t7= (TextView) convertView.findViewById(R.id.t7);
            holder.states= (TextView) convertView.findViewById(R.id.tStates);
            holder.states.setVisibility(View.INVISIBLE);
            convertView.setTag(holder);
        }else{
           holder= (ViewHolder) convertView.getTag();
    }
        EvaluteBean bean=list.get(position);

        holder.t1.setText(bean.getT1());
        holder.t2.setText(bean.getT2());
        holder.t3.setText(bean.getT3());
        holder.t4.setText(bean.getT4());
        holder.t5.setText(bean.getT5());
        holder.t6.setText(bean.getT6());
        holder.t7.setText(bean.getT7());
        holder.states.setText(bean.getState()+"");
        return convertView;
    }

    class ViewHolder{
        TextView t1;
        TextView t2;
        TextView t3;
        TextView t4;
        TextView t5;
        TextView t6;
        TextView t7;
        TextView states;

    }
}
